UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fiVQh81SI8GE3bYcSP3TbreSzqleSj21jM8scJzD3gY=' 
WHERE 
  key_id = '07d7823c37dd5992ad74348a16475b03a681d4b9fdbc5ca0a8e03d595d345e88' 
  AND (
    token = 'fiVQh81SI8GE3bYcSP3TbreSzqleSj21jM8scJzD3gY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025