UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'B1AwwjTKT9YIn9+phFcAg4zl1BuvuSQMiBSqt9O2MA8='
WHERE
key_id = 'e950b34473056831fe823ed64ca77c59dfec18d7d9283334445f80d21cbca62d'
AND (
token = 'B1AwwjTKT9YIn9+phFcAg4zl1BuvuSQMiBSqt9O2MA8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)