UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'u9RKCze273NohAd8INP0YW1Z6dDQ8UDA/V8SnObxbe4='
WHERE
key_id = 'b0d234ad4fb065318fc1ab7992eb2f1b72132c0bbae617e5a057d9dc4207ef5f'
AND (
token = 'u9RKCze273NohAd8INP0YW1Z6dDQ8UDA/V8SnObxbe4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)