UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZjJrah+xkv6xxn4yPfR5hD2lti5MZDybHaY2J40aJag='
WHERE
key_id = 'ceff4c312879e69cbde3ced2193eacbc6f8bd1616412eb2cbb011f2701725192'
AND (
token = 'ZjJrah+xkv6xxn4yPfR5hD2lti5MZDybHaY2J40aJag='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)