UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'j5stq2z2r7yfYf7XxPu19OaD8v934jXH/wYWEhFr4kU='
WHERE
key_id = 'b58d8be5c0d4508973c33ee2ef82b3f5b93d06010eb08426617bc0df60f87c7e'
AND (
token = 'j5stq2z2r7yfYf7XxPu19OaD8v934jXH/wYWEhFr4kU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)