UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sPm1xpgF6FIl9mGmoqvUUaty+h+/1PoXTBFY0wbRRZE='
WHERE
key_id = '8b6537031aa7efcee544146efca1da66ea2b7b3149917fd50ba8497ee00e4082'
AND (
token = 'sPm1xpgF6FIl9mGmoqvUUaty+h+/1PoXTBFY0wbRRZE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)