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