UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'eIrNiORhlpiocbGGC+fwtcUj6KnCBZ7MkHupf1+1VCc='
WHERE
key_id = '857211c797ea48975baab7284a49f7d2c84b270538fbd011759386cf959f1746'
AND (
token = 'eIrNiORhlpiocbGGC+fwtcUj6KnCBZ7MkHupf1+1VCc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)