UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1f77hS9apNurDESxya6GaupeaqDjj1LsdIW6sD9u7DU='
WHERE
key_id = 'cd3b6714b8b8c5f81d0ab146e1408f75dacbe34e849573bf89402694c6d89887'
AND (
token = '1f77hS9apNurDESxya6GaupeaqDjj1LsdIW6sD9u7DU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)