UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ri1GqBFOzSw0vreKO2kPHh0WrZ6zsbQklqrxEqfUoHk='
WHERE
key_id = 'ad2ef72d8bbb34523c5a8cee5f4c116dfbb7ce4104b8e61e72c52a5529a1e056'
AND (
token = 'ri1GqBFOzSw0vreKO2kPHh0WrZ6zsbQklqrxEqfUoHk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)