UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'K12ZgV+P5TCuQyxVzffeSpxDCggHKJAfwnCFI4UArDE='
WHERE
key_id = '5f91717f4d45947cc49d78b5eed85144b27161a80a2925e2400ca0e1ef60cfd6'
AND (
token = 'K12ZgV+P5TCuQyxVzffeSpxDCggHKJAfwnCFI4UArDE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)