UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZTI6PIgMHZNGB6wRJJ7j3aDaq/2u+j8I+Lx0gbvLQYM='
WHERE
key_id = 'cd3a995a80794c90d4d88e29db3937860b6570a63f1a1f6128da5c5bb1c82602'
AND (
token = 'ZTI6PIgMHZNGB6wRJJ7j3aDaq/2u+j8I+Lx0gbvLQYM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)