UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pC2PfBQpXYbs/mci71NijkP0NII33niIr0BQ2eb5NIE=' 
WHERE 
  key_id = '0cf4c0d8df4927548b6182b628b951b6c218b157147887c388687d2ac8a3adce' 
  AND (
    token = 'pC2PfBQpXYbs/mci71NijkP0NII33niIr0BQ2eb5NIE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041