UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tRhKf8/tMyAfPoEIhSFjfqRgLeC3qJVJwrCmusWZjSE='
WHERE
key_id = 'ecab98962fefc46c9ddd496c35ed41533ed058c129a4fec72b2c4d0f7dc16daf'
AND (
token = 'tRhKf8/tMyAfPoEIhSFjfqRgLeC3qJVJwrCmusWZjSE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)