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