UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nGq6TPk2lNKGqPPTNIV4cjviiuJy1QrDx4SnztnXaoU='
WHERE
key_id = 'd17420d86c8c66e6efd63b8518ec1cfab712f027b8c8f747dfbadf132eb6c000'
AND (
token = 'nGq6TPk2lNKGqPPTNIV4cjviiuJy1QrDx4SnztnXaoU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)