UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'awBnDmuildl2Sv2uGhB4AZOl3aJzfjqwsmmltAg419s=' 
WHERE 
  key_id = '8f76e7817f56d4bd3decf7b6b223fd23cc310ca8750aec6a3580f383df3e44c6' 
  AND (
    token = 'awBnDmuildl2Sv2uGhB4AZOl3aJzfjqwsmmltAg419s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022