UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6m4BlRWWVxLsmzMAverlc1eyRmpBphw6Jb028l1vPH8='
WHERE
key_id = '0d781ff0ba158b5bd2228546a282931cd885c96ee56eb6851f6e2fa910d4010f'
AND (
token = '6m4BlRWWVxLsmzMAverlc1eyRmpBphw6Jb028l1vPH8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)