UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nQmJ/jTQucanEC7qSt0qkOS7Coo43a7nxQJ4cocmOd8='
WHERE
key_id = '0221064c0896916cd204723c6892cf668371d12e82cd32a30df31d34f5854ddd'
AND (
token = 'nQmJ/jTQucanEC7qSt0qkOS7Coo43a7nxQJ4cocmOd8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)