UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'B56Em3ENzMgSJS/LXqKdEW9ZFffpJz3SQgUnLVf1KBA='
WHERE
key_id = 'bd540313830974b8a6e274ad7906fb1f0af9735c8f532a5856bb6b2931a61fc4'
AND (
token = 'B56Em3ENzMgSJS/LXqKdEW9ZFffpJz3SQgUnLVf1KBA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)