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