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

Query time 0.00041