UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'D0/z2F52WveI9g882ZKWyoBSS4YDTz9bRcjrhR5TkYU='
WHERE
key_id = 'd46a741540f27c0088cd5c62dc8a84e100b0e99098f2b12686e95e36f9b7a15c'
AND (
token = 'D0/z2F52WveI9g882ZKWyoBSS4YDTz9bRcjrhR5TkYU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)