UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hpVr8Z1N0OpnnJVlRBa06tZ8MXTXUOAmVrV/G4PpKC4=' 
WHERE 
  key_id = '6786a1473efb175040e6170a730cb64adf352ea8a3f15f0df142df8a72f366e8' 
  AND (
    token = 'hpVr8Z1N0OpnnJVlRBa06tZ8MXTXUOAmVrV/G4PpKC4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017