UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EPb2qDMRcoKVjF+XBtVUrbGTYHfWefTqkQHeLLYUbsM='
WHERE
key_id = 'f3d5815519e2f9056b95fbfdb43eb8903d2eaa70161bc435d82169724f7e5f00'
AND (
token = 'EPb2qDMRcoKVjF+XBtVUrbGTYHfWefTqkQHeLLYUbsM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)