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