UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nlXy457qcUwuWQ18Y3TwYSsA1hW2yz1jTv0wDFmvCNs='
WHERE
key_id = '9051381e85eaa53f7e187a8da633530d33a8f73bb949fbbcc8948e55ed278d54'
AND (
token = 'nlXy457qcUwuWQ18Y3TwYSsA1hW2yz1jTv0wDFmvCNs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)