UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lWqpbYXJN/baXty8i5b65PnsDhX3EsLVUuGNHZ2Mh3Q='
WHERE
key_id = '79bfb826c12bf13c4d757718ea61630b394c1439c295d02804a5064cf3dd0aa3'
AND (
token = 'lWqpbYXJN/baXty8i5b65PnsDhX3EsLVUuGNHZ2Mh3Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)