UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tWe0N6HxUOg8sZXcL4q3xQLF7s1uTCqFJyrnCkbhcbo=' 
WHERE 
  key_id = '747c06d1c6b4bc4eb70d86f87d761d295782c875ba97bdf6d487463039ccec0b' 
  AND (
    token = 'tWe0N6HxUOg8sZXcL4q3xQLF7s1uTCqFJyrnCkbhcbo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027