UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hMbpEjUCMBmIlvyp38+XokKhtqBoZbW0tNSqpFar5eE='
WHERE
key_id = '5b3bf2c631a8c6cae64f9e05a1d481b4d5111a41e492ff9f2fee99ec435957ad'
AND (
token = 'hMbpEjUCMBmIlvyp38+XokKhtqBoZbW0tNSqpFar5eE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)