UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kq9c6GZm8lWjCxzd12toKMq3T9rjQILfJ5XTjEdn5F8='
WHERE
key_id = 'cfc7a7e38623dbe61c4c01be0c6a4b167f74f549eea8f0e00b4271f1c2e148a5'
AND (
token = 'kq9c6GZm8lWjCxzd12toKMq3T9rjQILfJ5XTjEdn5F8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)