UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hVyjlrz8p1MhLgqKPTGyzHzRZgRA8n0A1JKx7arPtB8='
WHERE
key_id = '800ab3dcbd45db06af7fc1697d459601cd8445aa67bc8455390516dea218ca47'
AND (
token = 'hVyjlrz8p1MhLgqKPTGyzHzRZgRA8n0A1JKx7arPtB8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)